package com.lz.autotest.config.framework.interceptor;

/**
 * Created by ershuai.zhao on 2019/12/24.
 */

import com.github.pagehelper.PageInterceptor;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author ershuai.zhao
 */
@Configuration
@AutoConfigureBefore(PageInterceptor.class)
public class MybatisInterceptorConfig {
    @Bean
    public String myInterceptor(SqlSessionFactory sqlSessionFactory) {
        sqlSessionFactory.getConfiguration().addInterceptor(new ExecutorInterceptor());
        return "interceptor";
    }
}